/*************************************************************************
	> File Name: bubble_sort.cpp
	> Author: 
	> Mail: 
	> Created Time: Wed 07 Aug 2024 10:05:29 AM CST
 ************************************************************************/

#include <cstdio>
#include <cstdlib>
#include "0.sort_test.h"

void bubbleSort(int *arr, int l, int r) {
	for(int i = r - 1, I = l + 1; i >= I; --i) {
		for(int j = l; j < i; ++j) {
			if(arr[j] > arr[j + 1]) 
				swap(arr[j], arr[j + 1]);
		}
	}
	return ;
}

int main() {
	int *arr = getRandData(SMALL_DATA);
	TEST(bubbleSort, arr, SMALL_DATA);
	free(arr);
	return 0;
}

